package com.xmfh.wemedia.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xmfh.wemedia.mapper.DdAlbumMapper;
import com.xmfh.wemedia.model.DdAlbum;
import com.xmfh.wemedia.service.IDdAlbumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 * 相册表 服务实现类
 * </p>
 *
 * @author admin
 * @since 2022-04-03
 */
@Service
public class DdAlbumServiceImpl extends ServiceImpl<DdAlbumMapper, DdAlbum> implements IDdAlbumService {

    @Autowired(required = false)
    private DdAlbumMapper ddAlbumMapper;

    @Override
    public boolean addAlbum(DdAlbum album){
        album.setCreateTime(LocalDateTime.now());
        album.setFabulous(0);   //初始化点赞数
        album.setComment(0);    //初始化评论数
        album.setViews(0);      //初始化浏览量
        album.setHot(0);        //初始化热度值
        int i = ddAlbumMapper.insert(album);
        if (i==1){
            return true;
        }else{
            return false;
        }
    }

}
